var Request = new Object(); 
Request = GetRequest(); 

//全局变量
var activeId,mppId;
ajax({
	url:"http://www.antmall.cc/public/wx/collect/data/"+activeId+"/"+mppId+".html",
	success:function(data){
		var info = JSON.parse(data);
		var gift=info.data.gift;
		var giftReceive=info.data.giftReceive;
		var oImg=document.getElementsByClassName("info_left")[0];
		var title=document.getElementsByClassName("title")[0];
		var price=document.getElementsByClassName("price")[0];
		var total_num=document.getElementsByClassName("totalNum")[0];
		var address=document.getElementsByClassName("address")[0];
		
		oImg.style.backgroundImage = "url("+gift.giftImg+")";
		title.innerHTML=giftReceive.title;
		price.innerHTML="￥"+giftReceive.giftPrice/100+".00";
		total_num.innerHTML=giftReceive.giftTotal;
		address.innerHTML=info.data.active.bizShop.address;
	}
})

function GetRequest() { 
	var url = location.search; 
	var theRequest = new Object(); 
	if (url.indexOf("?") != -1) { 
	var str = url.substr(1); 
	strs = str.split("&"); 
	for(var i = 0; i < strs.length; i ++) { 
	theRequest[strs[i].split("=")[0]]=unescape(strs[i].split("=")[1]); 
	} 
	} 
	return theRequest;
}

var ajax = function(info){
	if(window.XMLHttpRequest){
		var xhr = new XMLHttpRequest();	
	}else{
		var xhr = new ActiveXObject("Microsoft.XMLHTTP");
	}
	var url = info.url;
	var type = info.type||"GET";
	var data = info.data||"";
	
	if(type=="GET"){
		xhr.open("GET",url,true);
		xhr.send();
	}else{
		xhr.open("POST",url,true);
		xhr.setRequestHeader("myHeader","myvalue");
		xhr.send(data);
	}
	
	xhr.onload = function(){
		if(info.success){
			info.success(xhr.responseText);
		}
	}
}